<style tyle="text/css">
</style>
<div class="col-sm-12 mt20">
    <div class="panel panel-default">
        <div class="panel-body" ng-keyup="myKeyup($event)">
            <div class="col-xs-12 row">
                <div class="col-sm-2">
                    <input type="text" class="form-control" placeholder="卡面号" ng-model="searchform.smart_card_no">
                </div>
                <div class="col-sm-2">
                    <input type="text" class="form-control" placeholder="登录账号" ng-model="searchform.loginName">
                </div>
                <div class="col-sm-2">
                    <input type="text" class="form-control" placeholder="设备号" ng-model="searchform.device_code">
                </div>
                <div class="col-sm-2">
                    <input type="text" 
                        class="form-control" 
                        datepicker-popup="yyyy-MM-dd" 
                        ng-model="period_start.value" 
                        is-open="period_start.opened" 
                        ng-click="dateOpen($event, period_start)"
                        placeholder="开始时间" 
                        ng-required="true" 
                        close-text="关闭" 
                        current-text="今天" 
                        clear-text="清除" 
                        readonly/>
                </div>
                <div class="col-sm-2">
                    <input type="text" 
                        class="form-control" 
                        datepicker-popup="yyyy-MM-dd" 
                        ng-model="period_end.value" 
                        is-open="period_end.opened" 
                        ng-click="dateOpen($event, period_end)"
                        placeholder="结束时间" 
                        ng-required="true" 
                        close-text="关闭" 
                        current-text="今天" 
                        clear-text="清除" 
                        readonly/>
                </div>
                <div class="col-sm-2">
                    <button class="btn btn-info search btn-block" ng-click="loadList()">立即搜索</button>
                </div>
            </div>
            <div class="col-xs-12 row mt20">
                <div class="col-sm-2">
                    <ui-select ng-model="searchform.card_type" theme="bootstrap">
                        <ui-select-match placeholder="选择卡类型...">{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="item.code as item in category_list">
                            <span ng-bind-html="item.name | highlight: $select.search"></span>
                        </ui-select-choices>
                    </ui-select>
                </div>
                <div class="col-sm-2">
                    <select type="text" class="form-control" aria-placeholder="交易类型" ng-model="searchform.type">
                        <option value="">---明细类型---</option>
                        <option value="0">消费</option>
                        <option value="1">充值</option>
                        <option value="2">退款</option>
                    </select>
                </div>
                <div class="col-sm-2"></div>
                <div class="col-sm-2"></div>
                <div class="col-sm-2"></div>
                <div class="col-sm-2">
                    <input type="button " class="btn btn-info search form-control" ng-click="exportToExcel('#Excel_table')" value="导出Excel">
                    <a id="dlink" download="{{ExcelName}}.xls" ng-show="false"></a>
                </div>
            </div>
        </div>
        <div class="panel-body">
            <table class="table table-striped table-bordered dataTable table-condensed tree_table" style="table-layout:fixed">
                <thead>
                    <tr>
                        <th class="col-md-1 text-center">卡面号/卡类型</th>
                        <th class="col-md-1 text-center">交易类型</th>
                        <th class="col-md-1 text-center">消费金额(元)</th>
                        <th class="col-md-1 text-center">充值金额(元)</th>
                        <th class="col-md-1 text-center">退款金额(元)</th>
                        <!-- <th class="col-md-1 text-center">退款状态</th> -->
                        <th class="col-md-1 text-center">订单编号</th>
                        <th class="col-md-1 text-center">操作账号/设备号</th>
                        <th class="col-md-1 text-center">备注</th>
                        <th class="col-md-1 text-center">时间</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="detail in detaillist">
                        <td class="text-center">
                            {{detail.smart_card_no}}
                            <br />{{detail.card_type_name}}
                        </td>
                        <td class="text-center">
                            <span ng-if="detail.type == '0'">消费</span>
                            <span ng-if="detail.type == '1'">充值</span>
                            <span ng-if="detail.type == '2'">退款</span>
                        </td>
                        <td class="text-center">
                            {{detail.amount? detail.amount: '-'}}
                        </td>
                        <td class="text-center">
                            {{detail.type == '1'? detail.recharge: '-'}}
                        </td>
                        <td class="text-center">
                            {{detail.type == '2'? detail.back_pay_fee: '-'}}
                        </td>
                        <!-- <td class="text-center">
                            <span ng-if="detail.back_state == '0'">-需退款</span>
                            <span ng-if="detail.back_state == '1'">待退款</span>
                            <span ng-if="detail.back_state == '2'">退款完成</span>
                        </td> -->
                        <td class="text-center">{{detail.order_code}}</td>
                        <td class="text-center">
                            {{detail.loginName? detail.loginName: '-'}}
                            <br />{{detail.device_code? detail.device_code: '-'}}
                        </td>
                        <td class="text-center">{{detail.remark}}</td>
                        <td class="text-center">{{detail.create_time}}</td>
                    </tr>
                </tbody>
            </table>
            <div class="text-right">
                <pagination total-items="totalItems" ng-model="currentPage" ng-change="loadList()" previous-text="上一页" next-text="下一页" first-text="首页"
                    last-text="尾页" max-size="maxSize" boundary-links="true" rotate="false" items-per-page="itemsPerPage" class="m-t-none m-b">
                </pagination>
            </div>
            <table ng-show="false" id="Excel_table">
                <thead>
                    <tr>
                        <th class="col-md-1 text-center">卡面号</th>
                        <th class="col-md-1 text-center">卡类型</th>
                        <th class="col-md-1 text-center">交易类型</th>
                        <th class="col-md-1 text-center">消费金额(元)</th>
                        <th class="col-md-1 text-center">充值金额(元)</th>
                        <!-- <th class="col-md-1 text-center">退款状态</th> -->
                        <th class="col-md-1 text-center">订单编号</th>
                        <th class="col-md-1 text-center">操作账号</th>
                        <th class="col-md-1 text-center">设备号</th>
                        <th class="col-md-1 text-center">备注</th>
                        <th class="col-md-1 text-center">时间</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="detail in detaillistForExcel">
                        <td class="text-center">
                            '{{detail.smart_card_no}}
                        </td>
                        <td class="text-center">
                           {{detail.card_type_name}}
                        </td>
                        <td class="text-center">
                            <span ng-if="detail.type == '0'">消费</span>
                            <span ng-if="detail.type == '1'">充值</span>
                            <span ng-if="detail.type == '2'">退款</span>
                        </td>
                        <td class="text-center">
                            {{detail.amount}}
                        </td>
                        <td class="text-center">
                            {{detail.type == '1'? detail.recharge: '-'}}
                        </td>
                        <!-- <td class="text-center">
                            <span ng-if="detail.back_state == '0'">-需退款</span>
                            <span ng-if="detail.back_state == '1'">待退款</span>
                            <span ng-if="detail.back_state == '2'">退款完成</span>
                        </td> -->
                        <td class="text-center">'{{detail.order_code}}</td>
                        <td class="text-center">
                            {{detail.loginName? detail.loginName: '-'}}
                        </td>
                        <td class="text-center">
                            {{detail.device_code? detail.device_code: '-'}}
                        </td>
                        <td class="text-center">{{detail.remark}}</td>
                        <td class="text-center">{{detail.create_time}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>